﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="AiRiZu.User.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>
	爱日租—全球最时尚、最具先锋概念的房屋日租、短租服务网站！
</title>
<meta content="爱日租,日租,短租,租房,家庭公寓,自助公寓,家庭旅馆,旅游" name="keywords"/>
<meta content="爱日租是国内首家专注房屋短期租赁的信息发布和在线交易的网站，为房主和租户搭建起最值得信赖的沟通和交易平台" name="description"/>

<link rel="stylesheet" href="css/css.css" />
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/pixie.css" />
<link rel="stylesheet" href="css/pixie.css" />
<link rel="stylesheet" href="../FileUploader/fileuploader.css" />
<link rel="stylesheet" href="../css/imgareaselect-default.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="main"/>
<link rel="stylesheet" href="css/dashboard.css" />
<link rel="stylesheet" href="css/voucher.css" />
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/application6.js"></script>
<script type="text/javascript" src="js/home.js"></script>
<script type="text/javascript" src="js/translate.js"></script>
<script type="text/javascript" src="js/s_code.js?vid=1"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="layout" content="main"/>


<script type="text/javascript">
<!--
		function MM_preloadImages() { //v3.0
		  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
		    if(document.all.form.email.value != '') {
			    
		    	document.all.form.email.readonly = true;
			}
		}
		
		function MM_swapImgRestore() { //v3.0
		  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
		}
		
		function MM_findObj(n, d) { //v4.01
		  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		  if(!x && d.getElementById) x=d.getElementById(n); return x;
		}
		
		function MM_swapImage() { //v3.0
		  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
		}
		
		function showUpload() {
			var e = document.getElementById('uploadSpan')
			if(e.style.display == 'none') {
				e.style.display = ''
			} else {
				e.style.display = 'none'
			}
		}
		
		function toggleDiv() {
			var d = document.getElementById('upload_person_image');
			if(d.style.display == 'none') {
				d.style.display='';
				$('select').hide();
			} else {
				d.style.display='none';
				$('select').show();

				clearAll();
			}
		}
		
		function wait_for_upload() {
			//document.getElementById('upload_image_submit_button').disabled = true; 
			document.getElementById('upload_feedback').innerHTML = "<img src='/images/spinner.gif' />";
			document.getElementById('user_pic').style.opacity = '.4';
			document.getElementById('user_pic').style.filter = 'alpha(opacity=40)';
		}

		function clearAll(){
			//清楚imgareaselect and image
			$('#imgAreaSelect-body').html("");
			$('#editImage_1').html("");
			$('ul.qq-upload-list').html("");
		}
//-->
</script>
<script type="text/javascript" src="../FileUploader/fileuploader.js"></script>
<link rel="Stylesheet" href="../FileUploader/fileuploader.css" />
<script type="text/javascript" src="js/jquery.imgareaselect.min.js"></script>
<script type="text/javascript">
    var imgArea = null;
    var imageUrl = '';

    //是否需要剪切
    var imageCut = true;
    function cutImage() {
        if (imageCut && imgArea != null) {
            var sel = imgArea.getSelection();
            //alert(sel.x1 + ':' + sel.y1 + ";" + sel.x2 + ":" + sel.y2)
            $.post('handler/UpdateImg.ashx', { x1: sel.x1, y1: sel.y1, x2: sel.x2, y2: sel.y2, url: imageUrl },
		    	function() {
		    	    //alert('ddd')
		    	    window.location.reload(true);
		    	})
        } else {
            $.post('handler/ReImageName.ashx', { url: imageUrl },
		    	function() {
		    	    //alert('ddd')
		    	    window.location.reload(true);
		    	})
        }

    }

	function validate_email_send_code(self, resend){
		//校验email同时发送checkcode
		$.post('/ajax/vEmailSendcode', {email: $('#email_check').val()}, 
	    	function(json){
	    	if(json == '1'){
				//成功
				if(!resend){
					$(self).parent().next().css('display', 'inline-block');
		    		$(self).parent().hide();
				}
				alert('校验码发送成功')
		    }
		})
	}
	function validate_check_code(self, type){
		//校验验证码是否争取
		$.post('/ajax/checkCode', {code: $(self).prev().val(), type: type}, 
	    	function(json){
	    	if(json == '1'){
				//成功
	    		$(self).parent().next().css('display', 'inline-block');
	    		$(self).parent().hide();
		    }else{
				alert('您输入的校验码错误')
			}
		})
	}

	function validate_phone_send_code(self, resend){
		//校验phone同时发送checkcode
		$.post('/ajax/vPhoneSendCode', {phone: $('#phone_check').val()}, 
	    	function(json){
	    	if(json == '1'){
				//成功 
				if(!resend){
		    		$(self).parent().next().css('display', 'inline-block');
		    		$(self).parent().hide();
				}

				alert('校验码发送成功')
		    }
		})
	}
</script>



<script type="text/javascript">

//$(document).ready(function(){
//        opts = {};
//        AirbnbHomePage.init(opts);
//    });

function addEventHandler(target, type, func) { 
    if (target.addEventListener) 
        target.addEventListener(type, func, false); 
    else if (target.attachEvent) 
        target.attachEvent("on" + type, func); 
    else target["on" + type] = func; 
} 
addEventHandler(document, 'scroll', function() {
	document.getElementById('list_loading').style.top = $('body').scrollTop() + 'px';
});

function shiftLanguage(lang, country) {
	$.ajax({
		   type: "POST",
		   url: "/ajax/versionInternationalize",
		   data: 'lang=' + lang + '&country=' + country,
		   success: function(msg){
		   	   if(msg == 'success') {
		   	   	   window.location.reload(true);
		   	   }
		   }
		 });
}

//$(document).bind('click',function(event){  
//    var url = event.target.href;
//    if(event.target.parentNode.href) {
//		url = event.target.parentNode.href;
//    }
//    if(url && url.indexOf('http://') == 0) {
//    	if(url.indexOf("?") != -1 && (url.indexOf("/city") != -1 || url.indexOf("/list") != -1 || url.indexOf("/show") != -1)) {
//	    	post_to_url(url);
//	        event.preventDefault();  
//	        event.stopPropagation();
//    	}  
//    }  
//      
//},true);

function post_to_url(url) {
	var flag = false; // 目录到/room/show页面时是弹出新窗口，flag = false 不弹出，true是弹出
	if(url.indexOf("/room/show") != -1 && url.indexOf("?src=list") != -1){
        flag = true;
    }

    var form = document.createElement("form");
    var baseUrl = url.substring(0, url.indexOf("?"));
    var params = url.substring(url.indexOf("?") + 1, url.length);
    params = decodeURIComponent(params);
    params = params.replace("+", " ");
    var s = params.split("&");
    form.setAttribute("method", "post");
    form.setAttribute("action", baseUrl);
    for(var i = 0; i < s.length; i ++) {
        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", s[i].split("=")[0].replace('locationSearch', 'location'));
        hiddenField.setAttribute("value", s[i].split("=")[1]);
        form.appendChild(hiddenField);
    }
    $('body').append(form);
    if(flag){
        form.target="_blank"; // /room/show 新窗口弹出
    }
    
    form.submit();
}
</script>

<!--google analytics-->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22185191-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body>
<form id="Form1" action="Edit.aspx" runat="server">
	<div name="waitingDiv" id="waitingDiv" style="display: none;">
		<div id="list_loading" name="list_loading">
			<div id="list_loading_wrapper" class="rounded_more">
				<img src="/images/home_spinner.gif"
					style="display: block; float: left; padding: 0 12px 0 0;" />页面载入中...
			</div>
		</div>
	</div>
	<div class="header">
	    <a class="logo" title="爱日租" href="../default.aspx"></a>
	    <div class="top_bar">
		    <ul class="nav">
			
		        <li>
		            <span class="SayHi"><%=Session["aliance"] != null? "嗨! " + Session["aliance"].ToString() : ""%></span>
		        </li>

				<li>
				    <a href="DashBoard.aspx">用户中心</a>
				</li>
				    <li>
					    <strong>
						    <a href="/message/inbox?offset=0" class="message">
							    <span id="unReadMessages"></span>
						    </a>
					    </strong>
					</li>
					
					<li class="rounded">
					    <%--<asp:HyperLink ID="HyperLink1" runat="server" ></asp:HyperLink>--%>
						<a href="javascript:void(0)" onclick="AddFavorite(window.location,document.title)">收藏</a>
							<%--收藏--%>
						<%--<span class="star" title="收藏" id="userFavorites"></span></a>--%>
					</li>
				<script type="text/javascript" language="javascript">
				    function AddFavorite(sURL, sTitle) {
				        try {
				            window.external.addFavorite(sURL, sTitle);
				        }
				        catch (e) {
				            try {
				                window.sidebar.addPanel(sTitle, sURL, "");
				            }
				            catch (e) {
				                alert("加入收藏失败，请使用Ctrl+D进行添加");
				            }
				        }
				    }
                    
                </script>

				<li>
				        <asp:LinkButton id="logoutButton" runat="server" onclick="logoutButton_Click">退出</asp:LinkButton>
				    
				</li>
				
			
				<li style="display:none"><span class="ChoLanguage selected">
				<a href="#">简体中文</a></span></li>
                <li style="display:none"><span class="EngLanguage">
       	        <a href="#">English</a></span></li>
	     
			
			
		</ul>
		<a href="../SendRoom.aspx" class="btn list_your_space">
			<span>发布房间</span>		</a>		</div>
		<p class="customer_hot_line"><span>400-696-6656</span><a href="#">媒体报道</a></p>
	</div>
	



<div id="command_center">
 <!--
	menu =>  dashboard,inbox,rooms,trips,account,recommend
 -->

<ul id="nav">
	<li id="dashboardmenu"><a href="dashboard.aspx">我爱日租</a></li>
	<li id="inboxmenu"><a href="Index.aspx">收件箱</a></li>
	<li id="roomsmenu"><a href="MyRooms.aspx">我的房间</a></li>
	<li id="tripsmenu"><a href="Trips.aspx">出行计划</a></li>
	<li id="accountmenu"><a href="Warnset.aspx">账户信息</a></li>
	<li id="commentsmenu"><a href="Comments.aspx">评价推荐</a></li>
	<li id="vouchersmenu"><a href="Vouchersinvite.aspx">赢取租币</a></li>
</ul>

	











<script type="text/javascript">

	var item=document.getElementById('dashboardmenu');
	if (item){
		item.className='active';		
	}
	item=document.getElementById('edit_submenu');
	if (item){
		item.className='active';		
	}

</script>






  <div id="dashboard">
    <div id="left">
      <div id="user_box" class="box">
						<div class="top">
							<!-- 上传头像  begin-->
								
							<div class="PopBox" style="top: 10%; display: none;" id="upload_person_image">
							    <div class="PMain" style="height: 500px; width: 600px;">
							        <div class="title"><h3>上传一张新照片</h3><a class="close" onClick="toggleDiv();"></a></div>
						            <p><b>上传自己的照片可以在爱租网上为您赢得更多的信任，您可以上传自己喜欢的新照片</b></p><br />
						        <!-- content -->
                                    <div id="au-photoUploader">
                                        <noscript>
                                            <p>Please enable JavaScript to use file uploader.</p>
                                        </noscript>
                                    </div>
       
								    <div id="editImage_1" style="margin:0 30px;"></div>
									<button onClick="cutImage();">保存</button>
							    </div>
							    <div class="PopBoxBg" style="height: 508px; width: 608px;"></div>
							</div>
							
							<!-- 上传头像  end-->
						</div>
						<div class="middle">
							<div id="user_pic">
								<a href="#none" onClick="toggleDiv_edit();"> 
	                            <img height="200px" src="<%=TeSeimgurl %>" title='<%=Session["aliance"] != null? Session["aliance"].ToString() : ""%>' alt='<%=Session["aliance"] != null? Session["aliance"].ToString() : ""%>' width="200px" />								</a>							
	                        </div>
							<h1><%=Session["aliance"] != null? Session["aliance"].ToString() : ""%><br/>
								<span style="font-size: .55em; font-weight: bold; margin-left: 2px;">
									<a href="Edit.aspx">编辑个人信息</a>
									<a href="#" onClick="toggleDiv();" style="margin-left: 20px;">上传头像</a>
									<script type="text/javascript">
									    var au_photoUploader = new qq.FileUploader({
									        element: document.getElementById('au-photoUploader'),
									        action: 'handler/ImgFileUpload.ashx',
									        sizeLimit: 4096000,
									        onComplete: function(id, fileName, responseJSON) {
									            var json = responseJSON;
									            //清楚提示信息
									            clearAll();
									            imageUrl = json.path;
									            $('#editImage_1').html('<img id="editImage_11" src="' + json.path + '"/>');


									            //判断是否需要剪切
									            if (json.isCut) {
									                //alert(json.isCut)
									                imgArea = $('#editImage_11').imgAreaSelect({ x1: 0, y1: 0, x2: 200, y2: 200,
									                    instance: true, resizable: false, persistent: true, parent: '#imgAreaSelect-body'
									                });
									            } else {
									                imageCut = false;
									            }
									        }

									    });

									    function toggleDiv() {
									        var d = document.getElementById('upload_person_image');
									        if (d.style.display == 'none') {
									            d.style.display = '';
									        } else {
									            d.style.display = 'none';

									            clearAll();
									        }
									    }
									</script>
								</span>
							</h1>
						</div>
						<!-- middle -->
						<div class="bottom"></div>
					</div>
      
      <!-- /user -->
      <div id="quick_links" class="box">
        <div class="top"></div>
        <div class="middle">
          <h2>常用操作</h2>
          <ul>
			<li><a href="MyRooms.aspx">所有房间</a></li>
			<li><a href="Calendar.aspx">日历</a></li>
			<li><a href="MyListings.aspx">房间预订</a></li>
			<li><a href="Comments.aspx">评价</a></li>
            </ul>
        </div>
        <div class="bottom"></div>
      </div>
      
    </div>
    
    <!-- /left end-->
    <div id="main">
      <div id="editinfo" class="box">
        <div class="top"></div>
        <div class="middle" style="margin-bottom:-14px">
          <h2>编辑个人信息</h2>
          <form action="/user/update" method="post" name="form" id="form" >
			<input type="hidden" name="id" value="33591" id="id" />
			<input type="hidden" name="version" value="" id="version" />
          <ul class="info">
           	  <li class="first">
                <label for="" class="labeltxt_b">姓:</label>
				<input type="text" class="input_b inputtxt_l" name="firstName" size="30" style="margin-right:2px;" value="<%=Xing%>" id="firstName" />
              </li>
              
           	  <li>
                <label for="" class="labeltxt_b">名:</label>
				<input type="text" class="input_b inputtxt_l" name="lastName" size="30" style="margin-right:2px;" value="<%=Ming%>" id="lastName" />
              </li>
               
              <li>
                <label for="" class="labeltxt_b">电子邮件:</label>
                <div class="wj-profile-l">
				<input type="text" class="input_b inputtxt_l" name="email" size="30" style="margin-right:2px;" 
					onkeypress="if(!(event.keyCode==64 || event.keyCode==45 || event.keyCode==46 || event.keyCode==95 
						|| (event.keyCode>=48 && event.keyCode<=57) 
						|| (event.keyCode>=65 && event.keyCode<=90) || (event.keyCode>=97 && event.keyCode<=122))) event.returnValue=false" 
               	 	value="<%=Email%>" readonly id="email_check"/>
               	 
               	 
					 
             
               	 
               	 	<div class="wj-profile-right1" style="display:none">
               	 		<a href="javascript:void(0)" class="wj-profile-btn" onclick="validate_email_send_code(this, false)"><span>发送验证码</span></a><span class="wj-profile-tips">验证后可赢取200租币</span>
               	 	</div>
	             
	             
	             	<div class="wj-profile-right2" style="display:none;">
		             	<input class="input_profile_right" style="margin-right:2px;" type="text"/>
	             		<a href="javascript:void(0)" class="wj-profile-btn" onclick="validate_check_code(this, '1')"><span>验证</span></a>
	             		<a href="javascript:void(0)" class="wj-profile-btn" onclick="validate_email_send_code(this, true)"><span>重新发送</span></a>
	             	</div>
	             
	             
	             
          	 		<div class="wj-profile-right3" style="display: none;"><span>验证通过</span></div>
          	 	
               	 </div>
              </li>
               <li>
                <label for="" class="labeltxt_b">性别:</label>
				<select name="gender" id="gender" >
                    <option value="">请选择</option>
                    <option value="1" <%=Sex == 0 ? "selected=\"selected\"" : ""%> >男</option>
                    <option value="0" <%=Sex == 1 ? "selected=\"selected\"" : ""%> >女</option>
                </select>
               	 	
               	 	
              </li>
              <li>
                <label for="" class="labeltxt_b">学校:</label>
				<input type="text" class="input_b inputtxt_l" name="school" size="30" style="margin-right:2px;" value="<%=School%>" id="school" />
              </li>
              <li>
                <label for="" class="labeltxt_b">居住地:</label>
				<input type="text" class="input_b inputtxt_l" name="address" size="30" style="margin-right:2px;" value="<%=Adress%>" id="address" />
              </li>
              <li>
                <label for="" class="labeltxt_b">工作:</label>
				<input type="text" class="input_b inputtxt_l" name="work" size="30" style="margin-right:2px;" value="<%=Work%>" id="work" />
              </li>
              <li>
                <label for="" class="labeltxt_b">移动电话:</label>
                <div class="wj-profile-l">
               	 	
				<input type="text" class="input_b inputtxt_l" name="phoneNumber" size="30" style="margin-right:2px;" 
					maxlength="20" 
					onblur="if(this.value == '') this.value = '请输入您的移动电话';" 
					onclick="if(this.value == '请输入您的移动电话') this.value = '';"
					onkeypress="if(!(event.keyCode==43 || (event.keyCode>=48 && event.keyCode<=57))) event.returnValue=false" 
               	 	value="<%=MobileTelephone%>"  id="phone_check"/>
               	 	
               	 	
	               	 	<div class="wj-profile-right2" style="display:none">
			             	<input class="input_profile_right" style="margin-right:2px;" type="text"/>
		             		<a href="javascript:void(0)" class="wj-profile-btn" onclick="validate_check_code(this, '2')"><span>验证</span></a>
		             		<a href="javascript:void(0)" class="wj-profile-btn" onclick="validate_phone_send_code(this, true)"><span>重新发送</span></a>
		             	</div>
	               	 
	               	 
               	 		<div class="wj-profile-right3" style="display: none;"><span>验证通过</span></div>
               	 	
               	 	</div>
              </li>
              <li>
                <label for="" class="labeltxt_b">备用电话:</label>
				<input type="text" class="input_b inputtxt_l" name="backupPhoneNumber" size="30" style="margin-right:2px;" 
					onKeyUp="if(isNaN(this.value)) this.value=''" maxlength="20"
               	 	value="<%=TelephoneBack%>" id="telephone_back"/>
              </li>

           <li class="last">
                <label for="" style="vertical-align:top;" class="labeltxt_b">自我描述:</label>
                <textarea cols="40" id="description" name="description" rows="20" style="height:100px; width:420px; margin-top:-4px;" class="inputtxt_l" maxlength="255" ><%=MyDesc%></textarea>
            </li>
           <li class="last">
                <label for="" style="vertical-align:top;" class="labeltxt_b">出行计划:</label>
                <textarea cols="40" id="tripPlan" name="tripPlan" rows="20" style="height:100px; width:420px; margin-top:-4px;" onblur="if(this.value == '') this.value = '请输入您的短期出游计划，爱日租会带给您意外的惊喜！';" onclick="if(this.value == '请输入您的短期出游计划，爱日租会带给您意外的惊喜！') this.value = '';" class="inputtxt_l" maxlength="255" ><%=TravelPlans%></textarea>
            </li>
              </ul>
            </form>
        <p style="height:77px !important; margin-top:15px; text-align:center;margin-left:260px">
            <%--<asp:LinkButton class="b_blue" OnClick="Update" runat="server">保 存</asp:LinkButton>--%>
        	<a href="#none" class="b_all b_blue" onclick="update();">
				<script type="text/javascript">
				    function update() {
				        if (document.getElementById('tripPlan').value == '请输入您的短期出游计划，爱日租会带给您意外的惊喜！') document.getElementById('tripPlan').value = '';
				        
				        $.post('handler/UpdateUserInfo.ashx',
				            { Xing: document.getElementById("firstName").value,
				                Ming: document.getElementById("lastName").value,
				                Email: document.getElementById("email_check").value,
				                MobileTelephone: document.getElementById("phone_check").value,
				                //				            Pass: document.getElementById("Pass"),
				                Sex: document.getElementById("gender").value,
				                School: document.getElementById("school").value,
				                Adress: document.getElementById("address").value,
				                Work: document.getElementById("work").value,
				                TelephoneBack: document.getElementById("telephone_back").value,
				                MyDesc: document.getElementById("description").value,
				                TravelPlans: document.getElementById("tripPlan").value
				            },
				            function(result) {
				            })
				    }
				</script>
	        </a>
        </p>
        </div>
        <div class="bottom"></div>
      </div>
      <!-- /messages -->
    </div>
    <!-- /main -->
    <div class="clear"></div>
  </div>
  <!-- /dashboard -->
</div>
<div id="imgAreaSelect-body"></div>

</form>
	<!-- footer -->
	
<div id="footer">
  <p class="TxtEn">&copy; Copyright 2011 <a href="#">airizu.com 爱日租 版权所有</a>&nbsp;&nbsp;京ICP证110553 号
	 <br/>
	 <br/><img src="images/alipay.gif" width="123" height="40">&nbsp;&nbsp;
    <img src="images/tenpay.gif" width="96" height="40">&nbsp;&nbsp;    <img src="images/315.gif" width="89" height="40">    <img src="images/bluelogoair.gif"/></p>
</div>
</body>
</html>
